using System.Collections.Generic;
using UnityEngine;

namespace Scanline.Core
{
    public static class ScanlineAlgorithm
    {
        /// <summary>
        /// 获取多边形内所有坐标为整数的点
        /// </summary>
        /// <param name="points">多边形的顶点,必须按逆时针或顺时针顺序传入</param>
        /// <param name="ret">接收结果</param>
        public static void Scan(List<Vector2Int> vertices, List<Vector2Int> ret)
        {
            OrderedEdgeContainer orderedEdgeContainer = new(vertices);
            ActiveEdgeContainer activeEdgeContainer = new(orderedEdgeContainer);
            while(!activeEdgeContainer.End)
            {
                activeEdgeContainer.MoveUp(ret);
            }
        }
    }
}